﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NineRays.WebControls;
using System.Data;

namespace TimKen.Web.Admin
{
    public partial class Industry_Edit : System.Web.UI.Page
    {
        private BussLogic.Industry industry = new TimKen.BussLogic.Industry();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            DataSet ds = industry.GetList("");
            


            DataRow dr = ds.Tables[0].NewRow();
            dr["NameCn"] = "应用行业";
            dr["ParentID"] = DBNull.Value;
            dr["IndustryID"] = 0;

            ds.Tables[0].Rows.Add(dr);
            this.FlyTreeView1.DataSource = FlyTreeView.ConvertTabularDataToHierarchical(ds, "IndustryID", "ParentID");
            this.FlyTreeView1.DataBind();
        }

        protected void HideBtn_Click(object sender, EventArgs e)
        {
            int industryId = int.Parse(this.HideTextBox.Text);
            industry.Delete(industryId);
            BindData();
        }
    }
}
